/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ChateoController;

import java.net.InetAddress;
import java.util.ArrayList;

/**
 *
 * @author adrian
 * @author olga
 */
public class User {

    private InetAddress addr;
    private String login;
    private boolean loggedIn;
    
    private ArrayList<ChatMessage> messages;
    
    public User(InetAddress addr, String login) {
        this.addr = addr;
        this.login = login;
        loggedIn = false;
        messages = new ArrayList<ChatMessage>();

    }

    public User(InetAddress addr1, String login1, boolean state) {
        this.addr = addr1;
        this.login = login1;
        this.loggedIn = state;
    }

    public InetAddress getAddr() {
        return addr;
    }

    public String getLogin() {
        return login;
    }

    public boolean isLoggedIn() {
        return loggedIn;
    }

    public void setAddr(InetAddress addr) {
        this.addr = addr;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public void setLoggingState(boolean loggedIn) {
        this.loggedIn = loggedIn;
    }

    @Override
    public String toString() {
        String out = "";
        if (Controller.DebugMode()) {
            out = (" login " + login + "(" + addr + ")");
        } else {
            out = (login);
        }
        return out;

    }

    public ArrayList<ChatMessage> getMessages() {
        return messages;
    }

    public void setMessages(ArrayList<ChatMessage> messages) {
        this.messages = messages;
    }
    
   public void addMessage(ChatMessage msg){
       messages.add(msg);
   }

}
